#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;

const ll N = 2e5 + 10, INF = 0x3f3f3f3f;

ll n;ll t;
pair<ll,ll> a[N];

void solve()
{
    ll sum = 0, tmp = 0;
    cin >> n >> t;
    for (ll i = 1;i <= n;i++) { cin >> a[i].first;sum += a[i].first; }
    for (ll i = 1;i <= n;i++) { cin >> a[i].second; tmp += a[i].first * a[i].second; }
    if (sum + tmp < t) { cout << -1; return; }

    sort(a + 1, a + n + 1, greater<pair<ll,ll>>());

    ll ans = 0;
    for (ll i = 1;i <= n;i++) {
        if (sum + a[i].first * a[i].second < t) sum += a[i].first * a[i].second, ans += a[i].second;
        else {
            ll l = 0, r = a[i].second;
            while (l < r) {
                ll mid = (l + r) >> 1;
                if (sum + a[i].first * mid >= t) r = mid;
                else l = mid + 1;
            }
            sum += a[i].first * l;
            ans += l;
        }
    }
    if (sum >= t) cout << ans;
    else cout << -1;
}

signed main()
{
    //ios::sync_with_stdio(0);
    //cin.tie(0);cout.tie(0);
#define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
    std::istringstream in(R"()");
    std::cin.rdbuf(in.rdbuf());
#endif
    ll T = 1;
    //cin>>T;
    for (ll i = 1;i <= T;i++) {
        solve();
    }
}